package org.shijiagen.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

@Data
@TableName("user")
public class User {
    @JsonProperty("user_id")
    @TableId(type = IdType.AUTO)
    Integer userId;

    @Length(min = 6,message = "用户账号不能少于6位")
    String userName;

    @JsonInclude(JsonInclude.Include.NON_NULL)//不为空就序列化，为空就不序列化
    @NotBlank(message = "密码不能为空")
    String password;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @NotBlank(message = "手机号不能为空")
    String userPhonenumber;
}

